# encoding: utf-8
# @author: __匸匿
"""
@license: 980980524@qq.com,
@contact: qq:980980524
@file: config.py
@time: 19-1-2 下午7:40
@desc:
"""
from redis import StrictRedis


class Config(object):
    # 项目的配置
    DEBUG = True

    SECRET_KEY = 'hgE2YFMYZtZxTJ/9JlMBCndM1CeYZiXTVEdbnuMjp9nEe0OenBFijI14KOptOvu3'

    # 为mysql添加配置
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@127.0.0.1:3306/information13'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # Redis的配置
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379

    # session 保存位置
    SESSION_TYPE = 'redis'
#     开启session签名
    SESSION_USE_SIGNER = True
    # 指定session保存的redis
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
#     设置需要过期
    SESSION_PERMANENT = False
#     设置过期时间
    PERMANENT_SESSION_LIFETIME = 86400*2


class DevelopmentConfig(Config):
    # 开发环境下
    DEBUG = True

class ProductionConfig(Config):
    # 生产环境下
    DEBUG = False

class TestingConfig(Config):
    DEBUG = True
    TESTING = True

config = {
    "development": DevelopmentConfig,
    "production": ProductionConfig,
    "testing": TestingConfig
}